﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SilverlightLayouts.Layouts
{
    public partial class HeaderFreezeLayout : UserControl 
    {
        public double HeaderHeight
        {
            get 
            { 
                return (double)GetValue(HeaderHeightProperty); 
            }
            set { SetValue(HeaderHeightProperty, value); }
        }

        public static readonly DependencyProperty HeaderHeightProperty =
            DependencyProperty.Register("HeaderHeight", typeof(double), typeof(HeaderFreezeLayout), 
                                        new PropertyMetadata(0.0, (s, e) => 
                                        {
                                            HeaderFreezeLayout layout = (HeaderFreezeLayout)s;
                                            layout.HeaderContainer.Height = (double)e.NewValue;
                                        }));


        public double HeaderOffset
        {
            get { return (double)GetValue(HeaderOffsetProperty); }
            set { SetValue(HeaderOffsetProperty, value); }
        }

        public static readonly DependencyProperty HeaderOffsetProperty =
            DependencyProperty.Register("HeaderOffset", typeof(double), typeof(HeaderFreezeLayout),
                                        new PropertyMetadata(0.0));

        public object HeaderContent
        {
            get { return this.HeaderContainer.Content; }
            set { this.HeaderContainer.Content = value; }
        }

        public object ScrollContent
        {
            get { return this.ScrollContainer.Content; }
            set { this.ScrollContainer.Content = value; }
        }

        public HeaderFreezeLayout()
        {
            InitializeComponent();
        }
    }
}
